package com.warm.pump.module.work.dao.gen;

import java.util.List;
import java.util.Map;
import java.util.Date;
import java.math.BigDecimal;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.warm.pump.frame.gen.bean.PageBean;
import com.warm.pump.frame.gen.util.TypeCast;
import com.warm.pump.frame.gen.exception.ServiceException;
import com.warm.pump.module.work.bean.po.gen.WorkItemSub;
import com.warm.pump.module.work.mapper.gen.WorkItemSubMapper;
import com.warm.pump.module.work.bean.po.gen.WorkItemSubExample;

@Repository
public class WorkItemSubDao {
    // 日志对象
    private transient Log log = LogFactory.getLog(this.getClass());
    @Autowired
    private WorkItemSubMapper workItemSubMapper;

    // 增加一个后台WorkItemSub表

    public boolean insert(WorkItemSub workItemSub) {
        try {
            workItemSubMapper.insert(workItemSub);
            log.debug("后台WorkItemSub表增加成功");
            return true;
        } catch (Exception e) {
            log.debug("后台WorkItemSub表增加失败");
            throw new ServiceException("后台WorkItemSub表增加失败", e);
        }
    }
    // 增加一个后台WorkItemSub表Selective

    public boolean insertSelective(WorkItemSub workItemSub) {
        try {
            workItemSubMapper.insertSelective(workItemSub);
            log.debug("后台WorkItemSub表增加成功");
            return true;
        } catch (Exception e) {
            log.debug("后台WorkItemSub表增加失败");
            throw new ServiceException("后台WorkItemSub表增加失败", e);
        }
    }

    // 删除一个后台WorkItemSub表

    public boolean deleteByPrimaryKey(Long id) {
        try {
            workItemSubMapper.deleteByPrimaryKey(id);
            log.debug("后台WorkItemSub表删除成功");
            return true;
        } catch (Exception e) {
            log.debug("后台WorkItemSub表删除失败");
            throw new ServiceException("后台WorkItemSub表删除失败", e);
        }
    }
    // 删除一个后台WorkItemSub表byMap

    public boolean deleteByMap(Map workItemSubMap) {
        try {
            workItemSubMapper.deleteByExample(createWorkItemSubExample(workItemSubMap, null, null));
            log.debug("后台WorkItemSub根据Map删除成功");
            return true;
        } catch (Exception e) {
            log.debug("后台WorkItemSub根据GroupID删除失败");
            throw new ServiceException("后台WorkItemSub根据object删除失败", e);
        }
    }
    // 修改一个后台WorkItemSub表

    public boolean updateByPrimaryKey(WorkItemSub workItemSub) {
        try {
            workItemSubMapper.updateByPrimaryKey(workItemSub);
            log.debug("后台WorkItemSub表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台WorkItemSub表修改失败");
            throw new ServiceException("后台WorkItemSub表修改失败", e);
        }
    }
    // 修改一个后台WorkItemSub表Selective

    public boolean updateByPrimaryKeySelective(WorkItemSub workItemSub) {
        try {
            workItemSubMapper.updateByPrimaryKeySelective(workItemSub);
            log.debug("后台WorkItemSub表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台WorkItemSub表修改失败");
            throw new ServiceException("后台WorkItemSub表修改失败", e);
        }
    }
    // 修改一个后台WorkItemSub表

    public boolean updateByMap(WorkItemSub workItemSub, Map workItemSubMap) {
        try {
            workItemSubMapper.updateByExample(workItemSub, createWorkItemSubExample(workItemSubMap, null, null));
            log.debug("后台批量WorkItemSub表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台批量WorkItemSub表修改失败");
            throw new ServiceException("后台WorkItemSub表批量修改失败", e);
        }
    }
    // 修改一个后台WorkItemSub表Selective

    public boolean updateByMapSelective(WorkItemSub workItemSub, Map workItemSubMap) {
        try {
            workItemSubMapper.updateByExampleSelective(workItemSub, createWorkItemSubExample(workItemSubMap, null, null));
            log.debug("后台批量WorkItemSub表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台批量WorkItemSub表修改失败");
            throw new ServiceException("后台WorkItemSub表批量修改失败", e);
        }
    }

    // 查询一个后台WorkItemSub表

    public WorkItemSub selectByPrimaryKey(Long id) {
        return workItemSubMapper.selectByPrimaryKey(id);
    }

    // 查询一个后台WorkItemSub表-根据map

    public WorkItemSub selectByMap(Map workItemSubMap) {
        List<WorkItemSub> list = getListByMap(workItemSubMap);
        if (list == null || list.isEmpty()) {
            return null;
        } else {
            return list.get(0);
        }
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 查询所有后台WorkItemSub表

    public List<WorkItemSub> getListByMap(Map workItemSubMap) {

        return workItemSubMapper.selectByExample(createWorkItemSubExample(workItemSubMap, null, null));
    }

    //统计后台WorkItemSub表数量

    public int countTotalByMap(Map workItemSubMap) {

        return workItemSubMapper.countByExample(createWorkItemSubExample(workItemSubMap, null, null));
    }


    public List<WorkItemSub> getListByMapPage(Map workItemSubMap, int limitStart,
                                              int limitOffset) {

        return workItemSubMapper.selectByExample(createWorkItemSubExample(workItemSubMap, limitStart, limitOffset));
    }


    public PageBean getPageBeanByMap(Map workItemSubMap, int pageNo, int pageSize) {
        Integer count = countTotalByMap(workItemSubMap);
        PageBean pageBean = new PageBean();
        pageBean.setCount(count);
        pageBean.setPageNo(pageNo);
        pageBean.setPageSize(pageSize);
        int limitStart = pageBean.getStartNo();
        int limitOffset = pageSize;
        pageBean.setData(workItemSubMapper.selectByExample(createWorkItemSubExample(workItemSubMap, limitStart, limitOffset)));
        return pageBean;
    }

    private WorkItemSubExample createWorkItemSubExample(Map workItemSubMap, Integer limitStart, Integer limitOffset) {
        WorkItemSubExample workItemSubEx = new WorkItemSubExample();
        WorkItemSubExample.Criteria c = workItemSubEx.createCriteria();
        Long id_null = TypeCast.getLong(workItemSubMap.get("id_null"));
        Long id_notNull = TypeCast.getLong(workItemSubMap.get("id_notNull"));
        Long id = TypeCast.getLong(workItemSubMap.get("id"));
        Long id_not = TypeCast.getLong(workItemSubMap.get("id_not"));
        Long id_greater = TypeCast.getLong(workItemSubMap.get("id_greater"));
        Long id_greaterEqual = TypeCast.getLong(workItemSubMap.get("id_greaterEqual"));
        Long id_less = TypeCast.getLong(workItemSubMap.get("id_less"));
        Long id_lessEqual = TypeCast.getLong(workItemSubMap.get("id_lessEqual"));
        List<Long> id_in = TypeCast.getLongList(workItemSubMap.get("id_in"));
        List<Long> id_notIn = TypeCast.getLongList(workItemSubMap.get("id_notIn"));
        Long id_between1 = TypeCast.getLong(workItemSubMap.get("id_between1"));
        Long id_between2 = TypeCast.getLong(workItemSubMap.get("id_between2"));
        Long id_notBetween1 = TypeCast.getLong(workItemSubMap.get("id_notBetween1"));
        Long id_notBetween2 = TypeCast.getLong(workItemSubMap.get("id_notBetween2"));

        if (id_null != null) {
            c.andIdIsNull();
        }
        if (id_notNull != null) {
            c.andIdIsNotNull();
        }
        if (id != null) {
            c.andIdEqualTo(id);
        }
        if (id_not != null) {
            c.andIdNotEqualTo(id_not);
        }
        if (id_greater != null) {
            c.andIdGreaterThan(id_greater);
        }
        if (id_greaterEqual != null) {
            c.andIdGreaterThanOrEqualTo(id_greaterEqual);
        }
        if (id_less != null) {
            c.andIdLessThan(id_less);
        }
        if (id_lessEqual != null) {
            c.andIdLessThanOrEqualTo(id_lessEqual);
        }
        if (id_in != null) {
            c.andIdIn(id_in);
        }
        if (id_notIn != null) {
            c.andIdNotIn(id_notIn);
        }
        if (id_between1 != null) {
            c.andIdBetween(id_between1, id_between2);
        }
        if (id_notBetween1 != null) {
            c.andIdNotBetween(id_notBetween1, id_notBetween2);
        }
        Long itemId_null = TypeCast.getLong(workItemSubMap.get("itemId_null"));
        Long itemId_notNull = TypeCast.getLong(workItemSubMap.get("itemId_notNull"));
        Long itemId = TypeCast.getLong(workItemSubMap.get("itemId"));
        Long itemId_not = TypeCast.getLong(workItemSubMap.get("itemId_not"));
        Long itemId_greater = TypeCast.getLong(workItemSubMap.get("itemId_greater"));
        Long itemId_greaterEqual = TypeCast.getLong(workItemSubMap.get("itemId_greaterEqual"));
        Long itemId_less = TypeCast.getLong(workItemSubMap.get("itemId_less"));
        Long itemId_lessEqual = TypeCast.getLong(workItemSubMap.get("itemId_lessEqual"));
        List<Long> itemId_in = TypeCast.getLongList(workItemSubMap.get("itemId_in"));
        List<Long> itemId_notIn = TypeCast.getLongList(workItemSubMap.get("itemId_notIn"));
        Long itemId_between1 = TypeCast.getLong(workItemSubMap.get("itemId_between1"));
        Long itemId_between2 = TypeCast.getLong(workItemSubMap.get("itemId_between2"));
        Long itemId_notBetween1 = TypeCast.getLong(workItemSubMap.get("itemId_notBetween1"));
        Long itemId_notBetween2 = TypeCast.getLong(workItemSubMap.get("itemId_notBetween2"));

        if (itemId_null != null) {
            c.andItemIdIsNull();
        }
        if (itemId_notNull != null) {
            c.andItemIdIsNotNull();
        }
        if (itemId != null) {
            c.andItemIdEqualTo(itemId);
        }
        if (itemId_not != null) {
            c.andItemIdNotEqualTo(itemId_not);
        }
        if (itemId_greater != null) {
            c.andItemIdGreaterThan(itemId_greater);
        }
        if (itemId_greaterEqual != null) {
            c.andItemIdGreaterThanOrEqualTo(itemId_greaterEqual);
        }
        if (itemId_less != null) {
            c.andItemIdLessThan(itemId_less);
        }
        if (itemId_lessEqual != null) {
            c.andItemIdLessThanOrEqualTo(itemId_lessEqual);
        }
        if (itemId_in != null) {
            c.andItemIdIn(itemId_in);
        }
        if (itemId_notIn != null) {
            c.andItemIdNotIn(itemId_notIn);
        }
        if (itemId_between1 != null) {
            c.andItemIdBetween(itemId_between1, itemId_between2);
        }
        if (itemId_notBetween1 != null) {
            c.andItemIdNotBetween(itemId_notBetween1, itemId_notBetween2);
        }
        String subName_null = TypeCast.getString(workItemSubMap.get("subName_null"));
        String subName_notNull = TypeCast.getString(workItemSubMap.get("subName_notNull"));
        String subName = TypeCast.getString(workItemSubMap.get("subName"));
        String subName_not = TypeCast.getString(workItemSubMap.get("subName_not"));
        String subName_greater = TypeCast.getString(workItemSubMap.get("subName_greater"));
        String subName_greaterEqual = TypeCast.getString(workItemSubMap.get("subName_greaterEqual"));
        String subName_less = TypeCast.getString(workItemSubMap.get("subName_less"));
        String subName_lessEqual = TypeCast.getString(workItemSubMap.get("subName_lessEqual"));
        String subName_like = TypeCast.getString(workItemSubMap.get("subName_like"));
        String subName_notLike = TypeCast.getString(workItemSubMap.get("subName_notLike"));
        List<String> subName_in = TypeCast.getStringList(workItemSubMap.get("subName_in"));
        List<String> subName_notIn = TypeCast.getStringList(workItemSubMap.get("subName_notIn"));
        String subName_between1 = TypeCast.getString(workItemSubMap.get("subName_between1"));
        String subName_between2 = TypeCast.getString(workItemSubMap.get("subName_between2"));
        String subName_notBetween1 = TypeCast.getString(workItemSubMap.get("subName_notBetween1"));
        String subName_notBetween2 = TypeCast.getString(workItemSubMap.get("subName_notBetween2"));

        if (subName_null != null) {
            c.andSubNameIsNull();
        }
        if (subName_notNull != null) {
            c.andSubNameIsNotNull();
        }
        if (subName != null) {
            c.andSubNameEqualTo(subName);
        }
        if (subName_not != null) {
            c.andSubNameNotEqualTo(subName_not);
        }
        if (subName_greater != null) {
            c.andSubNameGreaterThan(subName_greater);
        }
        if (subName_greaterEqual != null) {
            c.andSubNameGreaterThanOrEqualTo(subName_greaterEqual);
        }
        if (subName_less != null) {
            c.andSubNameLessThan(subName_less);
        }
        if (subName_lessEqual != null) {
            c.andSubNameLessThanOrEqualTo(subName_lessEqual);
        }
        if (subName_like != null) {
            c.andSubNameLike(subName_like);
        }
        if (subName_notLike != null) {
            c.andSubNameNotLike(subName_notLike);
        }
        if (subName_in != null) {
            c.andSubNameIn(subName_in);
        }
        if (subName_notIn != null) {
            c.andSubNameNotIn(subName_notIn);
        }
        if (subName_between1 != null) {
            c.andSubNameBetween(subName_between1, subName_between2);
        }
        if (subName_notBetween1 != null) {
            c.andSubNameNotBetween(subName_notBetween1, subName_notBetween2);
        }
        String dbKeyFrom_null = TypeCast.getString(workItemSubMap.get("dbKeyFrom_null"));
        String dbKeyFrom_notNull = TypeCast.getString(workItemSubMap.get("dbKeyFrom_notNull"));
        String dbKeyFrom = TypeCast.getString(workItemSubMap.get("dbKeyFrom"));
        String dbKeyFrom_not = TypeCast.getString(workItemSubMap.get("dbKeyFrom_not"));
        String dbKeyFrom_greater = TypeCast.getString(workItemSubMap.get("dbKeyFrom_greater"));
        String dbKeyFrom_greaterEqual = TypeCast.getString(workItemSubMap.get("dbKeyFrom_greaterEqual"));
        String dbKeyFrom_less = TypeCast.getString(workItemSubMap.get("dbKeyFrom_less"));
        String dbKeyFrom_lessEqual = TypeCast.getString(workItemSubMap.get("dbKeyFrom_lessEqual"));
        String dbKeyFrom_like = TypeCast.getString(workItemSubMap.get("dbKeyFrom_like"));
        String dbKeyFrom_notLike = TypeCast.getString(workItemSubMap.get("dbKeyFrom_notLike"));
        List<String> dbKeyFrom_in = TypeCast.getStringList(workItemSubMap.get("dbKeyFrom_in"));
        List<String> dbKeyFrom_notIn = TypeCast.getStringList(workItemSubMap.get("dbKeyFrom_notIn"));
        String dbKeyFrom_between1 = TypeCast.getString(workItemSubMap.get("dbKeyFrom_between1"));
        String dbKeyFrom_between2 = TypeCast.getString(workItemSubMap.get("dbKeyFrom_between2"));
        String dbKeyFrom_notBetween1 = TypeCast.getString(workItemSubMap.get("dbKeyFrom_notBetween1"));
        String dbKeyFrom_notBetween2 = TypeCast.getString(workItemSubMap.get("dbKeyFrom_notBetween2"));

        if (dbKeyFrom_null != null) {
            c.andDbKeyFromIsNull();
        }
        if (dbKeyFrom_notNull != null) {
            c.andDbKeyFromIsNotNull();
        }
        if (dbKeyFrom != null) {
            c.andDbKeyFromEqualTo(dbKeyFrom);
        }
        if (dbKeyFrom_not != null) {
            c.andDbKeyFromNotEqualTo(dbKeyFrom_not);
        }
        if (dbKeyFrom_greater != null) {
            c.andDbKeyFromGreaterThan(dbKeyFrom_greater);
        }
        if (dbKeyFrom_greaterEqual != null) {
            c.andDbKeyFromGreaterThanOrEqualTo(dbKeyFrom_greaterEqual);
        }
        if (dbKeyFrom_less != null) {
            c.andDbKeyFromLessThan(dbKeyFrom_less);
        }
        if (dbKeyFrom_lessEqual != null) {
            c.andDbKeyFromLessThanOrEqualTo(dbKeyFrom_lessEqual);
        }
        if (dbKeyFrom_like != null) {
            c.andDbKeyFromLike(dbKeyFrom_like);
        }
        if (dbKeyFrom_notLike != null) {
            c.andDbKeyFromNotLike(dbKeyFrom_notLike);
        }
        if (dbKeyFrom_in != null) {
            c.andDbKeyFromIn(dbKeyFrom_in);
        }
        if (dbKeyFrom_notIn != null) {
            c.andDbKeyFromNotIn(dbKeyFrom_notIn);
        }
        if (dbKeyFrom_between1 != null) {
            c.andDbKeyFromBetween(dbKeyFrom_between1, dbKeyFrom_between2);
        }
        if (dbKeyFrom_notBetween1 != null) {
            c.andDbKeyFromNotBetween(dbKeyFrom_notBetween1, dbKeyFrom_notBetween2);
        }
        String subSql_null = TypeCast.getString(workItemSubMap.get("subSql_null"));
        String subSql_notNull = TypeCast.getString(workItemSubMap.get("subSql_notNull"));
        String subSql = TypeCast.getString(workItemSubMap.get("subSql"));
        String subSql_not = TypeCast.getString(workItemSubMap.get("subSql_not"));
        String subSql_greater = TypeCast.getString(workItemSubMap.get("subSql_greater"));
        String subSql_greaterEqual = TypeCast.getString(workItemSubMap.get("subSql_greaterEqual"));
        String subSql_less = TypeCast.getString(workItemSubMap.get("subSql_less"));
        String subSql_lessEqual = TypeCast.getString(workItemSubMap.get("subSql_lessEqual"));
        String subSql_like = TypeCast.getString(workItemSubMap.get("subSql_like"));
        String subSql_notLike = TypeCast.getString(workItemSubMap.get("subSql_notLike"));
        List<String> subSql_in = TypeCast.getStringList(workItemSubMap.get("subSql_in"));
        List<String> subSql_notIn = TypeCast.getStringList(workItemSubMap.get("subSql_notIn"));
        String subSql_between1 = TypeCast.getString(workItemSubMap.get("subSql_between1"));
        String subSql_between2 = TypeCast.getString(workItemSubMap.get("subSql_between2"));
        String subSql_notBetween1 = TypeCast.getString(workItemSubMap.get("subSql_notBetween1"));
        String subSql_notBetween2 = TypeCast.getString(workItemSubMap.get("subSql_notBetween2"));

        if (subSql_null != null) {
            c.andSubSqlIsNull();
        }
        if (subSql_notNull != null) {
            c.andSubSqlIsNotNull();
        }
        if (subSql != null) {
            c.andSubSqlEqualTo(subSql);
        }
        if (subSql_not != null) {
            c.andSubSqlNotEqualTo(subSql_not);
        }
        if (subSql_greater != null) {
            c.andSubSqlGreaterThan(subSql_greater);
        }
        if (subSql_greaterEqual != null) {
            c.andSubSqlGreaterThanOrEqualTo(subSql_greaterEqual);
        }
        if (subSql_less != null) {
            c.andSubSqlLessThan(subSql_less);
        }
        if (subSql_lessEqual != null) {
            c.andSubSqlLessThanOrEqualTo(subSql_lessEqual);
        }
        if (subSql_like != null) {
            c.andSubSqlLike(subSql_like);
        }
        if (subSql_notLike != null) {
            c.andSubSqlNotLike(subSql_notLike);
        }
        if (subSql_in != null) {
            c.andSubSqlIn(subSql_in);
        }
        if (subSql_notIn != null) {
            c.andSubSqlNotIn(subSql_notIn);
        }
        if (subSql_between1 != null) {
            c.andSubSqlBetween(subSql_between1, subSql_between2);
        }
        if (subSql_notBetween1 != null) {
            c.andSubSqlNotBetween(subSql_notBetween1, subSql_notBetween2);
        }
        Integer orderNum_null = TypeCast.getInteger(workItemSubMap.get("orderNum_null"));
        Integer orderNum_notNull = TypeCast.getInteger(workItemSubMap.get("orderNum_notNull"));
        Integer orderNum = TypeCast.getInteger(workItemSubMap.get("orderNum"));
        Integer orderNum_not = TypeCast.getInteger(workItemSubMap.get("orderNum_not"));
        Integer orderNum_greater = TypeCast.getInteger(workItemSubMap.get("orderNum_greater"));
        Integer orderNum_greaterEqual = TypeCast.getInteger(workItemSubMap.get("orderNum_greaterEqual"));
        Integer orderNum_less = TypeCast.getInteger(workItemSubMap.get("orderNum_less"));
        Integer orderNum_lessEqual = TypeCast.getInteger(workItemSubMap.get("orderNum_lessEqual"));
        List<Integer> orderNum_in = TypeCast.getIntegerList(workItemSubMap.get("orderNum_in"));
        List<Integer> orderNum_notIn = TypeCast.getIntegerList(workItemSubMap.get("orderNum_notIn"));
        Integer orderNum_between1 = TypeCast.getInteger(workItemSubMap.get("orderNum_between1"));
        Integer orderNum_between2 = TypeCast.getInteger(workItemSubMap.get("orderNum_between2"));
        Integer orderNum_notBetween1 = TypeCast.getInteger(workItemSubMap.get("orderNum_notBetween1"));
        Integer orderNum_notBetween2 = TypeCast.getInteger(workItemSubMap.get("orderNum_notBetween2"));

        if (orderNum_null != null) {
            c.andOrderNumIsNull();
        }
        if (orderNum_notNull != null) {
            c.andOrderNumIsNotNull();
        }
        if (orderNum != null) {
            c.andOrderNumEqualTo(orderNum);
        }
        if (orderNum_not != null) {
            c.andOrderNumNotEqualTo(orderNum_not);
        }
        if (orderNum_greater != null) {
            c.andOrderNumGreaterThan(orderNum_greater);
        }
        if (orderNum_greaterEqual != null) {
            c.andOrderNumGreaterThanOrEqualTo(orderNum_greaterEqual);
        }
        if (orderNum_less != null) {
            c.andOrderNumLessThan(orderNum_less);
        }
        if (orderNum_lessEqual != null) {
            c.andOrderNumLessThanOrEqualTo(orderNum_lessEqual);
        }
        if (orderNum_in != null) {
            c.andOrderNumIn(orderNum_in);
        }
        if (orderNum_notIn != null) {
            c.andOrderNumNotIn(orderNum_notIn);
        }
        if (orderNum_between1 != null) {
            c.andOrderNumBetween(orderNum_between1, orderNum_between2);
        }
        if (orderNum_notBetween1 != null) {
            c.andOrderNumNotBetween(orderNum_notBetween1, orderNum_notBetween2);
        }
        Date createTime_null = TypeCast.getDate(workItemSubMap.get("createTime_null"));
        Date createTime_notNull = TypeCast.getDate(workItemSubMap.get("createTime_notNull"));
        Date createTime = TypeCast.getDate(workItemSubMap.get("createTime"));
        Date createTime_not = TypeCast.getDate(workItemSubMap.get("createTime_not"));
        Date createTime_greater = TypeCast.getDate(workItemSubMap.get("createTime_greater"));
        Date createTime_greaterEqual = TypeCast.getDate(workItemSubMap.get("createTime_greaterEqual"));
        Date createTime_less = TypeCast.getDate(workItemSubMap.get("createTime_less"));
        Date createTime_lessEqual = TypeCast.getDate(workItemSubMap.get("createTime_lessEqual"));
        List<Date> createTime_in = TypeCast.getDateList(workItemSubMap.get("createTime_in"));
        List<Date> createTime_notIn = TypeCast.getDateList(workItemSubMap.get("createTime_notIn"));
        Date createTime_between1 = TypeCast.getDate(workItemSubMap.get("createTime_between1"));
        Date createTime_between2 = TypeCast.getDate(workItemSubMap.get("createTime_between2"));
        Date createTime_notBetween1 = TypeCast.getDate(workItemSubMap.get("createTime_notBetween1"));
        Date createTime_notBetween2 = TypeCast.getDate(workItemSubMap.get("createTime_notBetween2"));

        if (createTime_null != null) {
            c.andCreateTimeIsNull();
        }
        if (createTime_notNull != null) {
            c.andCreateTimeIsNotNull();
        }
        if (createTime != null) {
            c.andCreateTimeEqualTo(createTime);
        }
        if (createTime_not != null) {
            c.andCreateTimeNotEqualTo(createTime_not);
        }
        if (createTime_greater != null) {
            c.andCreateTimeGreaterThan(createTime_greater);
        }
        if (createTime_greaterEqual != null) {
            c.andCreateTimeGreaterThanOrEqualTo(createTime_greaterEqual);
        }
        if (createTime_less != null) {
            c.andCreateTimeLessThan(createTime_less);
        }
        if (createTime_lessEqual != null) {
            c.andCreateTimeLessThanOrEqualTo(createTime_lessEqual);
        }
        if (createTime_in != null) {
            c.andCreateTimeIn(createTime_in);
        }
        if (createTime_notIn != null) {
            c.andCreateTimeNotIn(createTime_notIn);
        }
        if (createTime_between1 != null) {
            c.andCreateTimeBetween(createTime_between1, createTime_between2);
        }
        if (createTime_notBetween1 != null) {
            c.andCreateTimeNotBetween(createTime_notBetween1, createTime_notBetween2);
        }
        Date updateTime_null = TypeCast.getDate(workItemSubMap.get("updateTime_null"));
        Date updateTime_notNull = TypeCast.getDate(workItemSubMap.get("updateTime_notNull"));
        Date updateTime = TypeCast.getDate(workItemSubMap.get("updateTime"));
        Date updateTime_not = TypeCast.getDate(workItemSubMap.get("updateTime_not"));
        Date updateTime_greater = TypeCast.getDate(workItemSubMap.get("updateTime_greater"));
        Date updateTime_greaterEqual = TypeCast.getDate(workItemSubMap.get("updateTime_greaterEqual"));
        Date updateTime_less = TypeCast.getDate(workItemSubMap.get("updateTime_less"));
        Date updateTime_lessEqual = TypeCast.getDate(workItemSubMap.get("updateTime_lessEqual"));
        List<Date> updateTime_in = TypeCast.getDateList(workItemSubMap.get("updateTime_in"));
        List<Date> updateTime_notIn = TypeCast.getDateList(workItemSubMap.get("updateTime_notIn"));
        Date updateTime_between1 = TypeCast.getDate(workItemSubMap.get("updateTime_between1"));
        Date updateTime_between2 = TypeCast.getDate(workItemSubMap.get("updateTime_between2"));
        Date updateTime_notBetween1 = TypeCast.getDate(workItemSubMap.get("updateTime_notBetween1"));
        Date updateTime_notBetween2 = TypeCast.getDate(workItemSubMap.get("updateTime_notBetween2"));

        if (updateTime_null != null) {
            c.andUpdateTimeIsNull();
        }
        if (updateTime_notNull != null) {
            c.andUpdateTimeIsNotNull();
        }
        if (updateTime != null) {
            c.andUpdateTimeEqualTo(updateTime);
        }
        if (updateTime_not != null) {
            c.andUpdateTimeNotEqualTo(updateTime_not);
        }
        if (updateTime_greater != null) {
            c.andUpdateTimeGreaterThan(updateTime_greater);
        }
        if (updateTime_greaterEqual != null) {
            c.andUpdateTimeGreaterThanOrEqualTo(updateTime_greaterEqual);
        }
        if (updateTime_less != null) {
            c.andUpdateTimeLessThan(updateTime_less);
        }
        if (updateTime_lessEqual != null) {
            c.andUpdateTimeLessThanOrEqualTo(updateTime_lessEqual);
        }
        if (updateTime_in != null) {
            c.andUpdateTimeIn(updateTime_in);
        }
        if (updateTime_notIn != null) {
            c.andUpdateTimeNotIn(updateTime_notIn);
        }
        if (updateTime_between1 != null) {
            c.andUpdateTimeBetween(updateTime_between1, updateTime_between2);
        }
        if (updateTime_notBetween1 != null) {
            c.andUpdateTimeNotBetween(updateTime_notBetween1, updateTime_notBetween2);
        }
        String subType_null = TypeCast.getString(workItemSubMap.get("subType_null"));
        String subType_notNull = TypeCast.getString(workItemSubMap.get("subType_notNull"));
        String subType = TypeCast.getString(workItemSubMap.get("subType"));
        String subType_not = TypeCast.getString(workItemSubMap.get("subType_not"));
        String subType_greater = TypeCast.getString(workItemSubMap.get("subType_greater"));
        String subType_greaterEqual = TypeCast.getString(workItemSubMap.get("subType_greaterEqual"));
        String subType_less = TypeCast.getString(workItemSubMap.get("subType_less"));
        String subType_lessEqual = TypeCast.getString(workItemSubMap.get("subType_lessEqual"));
        String subType_like = TypeCast.getString(workItemSubMap.get("subType_like"));
        String subType_notLike = TypeCast.getString(workItemSubMap.get("subType_notLike"));
        List<String> subType_in = TypeCast.getStringList(workItemSubMap.get("subType_in"));
        List<String> subType_notIn = TypeCast.getStringList(workItemSubMap.get("subType_notIn"));
        String subType_between1 = TypeCast.getString(workItemSubMap.get("subType_between1"));
        String subType_between2 = TypeCast.getString(workItemSubMap.get("subType_between2"));
        String subType_notBetween1 = TypeCast.getString(workItemSubMap.get("subType_notBetween1"));
        String subType_notBetween2 = TypeCast.getString(workItemSubMap.get("subType_notBetween2"));

        if (subType_null != null) {
            c.andSubTypeIsNull();
        }
        if (subType_notNull != null) {
            c.andSubTypeIsNotNull();
        }
        if (subType != null) {
            c.andSubTypeEqualTo(subType);
        }
        if (subType_not != null) {
            c.andSubTypeNotEqualTo(subType_not);
        }
        if (subType_greater != null) {
            c.andSubTypeGreaterThan(subType_greater);
        }
        if (subType_greaterEqual != null) {
            c.andSubTypeGreaterThanOrEqualTo(subType_greaterEqual);
        }
        if (subType_less != null) {
            c.andSubTypeLessThan(subType_less);
        }
        if (subType_lessEqual != null) {
            c.andSubTypeLessThanOrEqualTo(subType_lessEqual);
        }
        if (subType_like != null) {
            c.andSubTypeLike(subType_like);
        }
        if (subType_notLike != null) {
            c.andSubTypeNotLike(subType_notLike);
        }
        if (subType_in != null) {
            c.andSubTypeIn(subType_in);
        }
        if (subType_notIn != null) {
            c.andSubTypeNotIn(subType_notIn);
        }
        if (subType_between1 != null) {
            c.andSubTypeBetween(subType_between1, subType_between2);
        }
        if (subType_notBetween1 != null) {
            c.andSubTypeNotBetween(subType_notBetween1, subType_notBetween2);
        }
        String cacheName_null = TypeCast.getString(workItemSubMap.get("cacheName_null"));
        String cacheName_notNull = TypeCast.getString(workItemSubMap.get("cacheName_notNull"));
        String cacheName = TypeCast.getString(workItemSubMap.get("cacheName"));
        String cacheName_not = TypeCast.getString(workItemSubMap.get("cacheName_not"));
        String cacheName_greater = TypeCast.getString(workItemSubMap.get("cacheName_greater"));
        String cacheName_greaterEqual = TypeCast.getString(workItemSubMap.get("cacheName_greaterEqual"));
        String cacheName_less = TypeCast.getString(workItemSubMap.get("cacheName_less"));
        String cacheName_lessEqual = TypeCast.getString(workItemSubMap.get("cacheName_lessEqual"));
        String cacheName_like = TypeCast.getString(workItemSubMap.get("cacheName_like"));
        String cacheName_notLike = TypeCast.getString(workItemSubMap.get("cacheName_notLike"));
        List<String> cacheName_in = TypeCast.getStringList(workItemSubMap.get("cacheName_in"));
        List<String> cacheName_notIn = TypeCast.getStringList(workItemSubMap.get("cacheName_notIn"));
        String cacheName_between1 = TypeCast.getString(workItemSubMap.get("cacheName_between1"));
        String cacheName_between2 = TypeCast.getString(workItemSubMap.get("cacheName_between2"));
        String cacheName_notBetween1 = TypeCast.getString(workItemSubMap.get("cacheName_notBetween1"));
        String cacheName_notBetween2 = TypeCast.getString(workItemSubMap.get("cacheName_notBetween2"));

        if (cacheName_null != null) {
            c.andCacheNameIsNull();
        }
        if (cacheName_notNull != null) {
            c.andCacheNameIsNotNull();
        }
        if (cacheName != null) {
            c.andCacheNameEqualTo(cacheName);
        }
        if (cacheName_not != null) {
            c.andCacheNameNotEqualTo(cacheName_not);
        }
        if (cacheName_greater != null) {
            c.andCacheNameGreaterThan(cacheName_greater);
        }
        if (cacheName_greaterEqual != null) {
            c.andCacheNameGreaterThanOrEqualTo(cacheName_greaterEqual);
        }
        if (cacheName_less != null) {
            c.andCacheNameLessThan(cacheName_less);
        }
        if (cacheName_lessEqual != null) {
            c.andCacheNameLessThanOrEqualTo(cacheName_lessEqual);
        }
        if (cacheName_like != null) {
            c.andCacheNameLike(cacheName_like);
        }
        if (cacheName_notLike != null) {
            c.andCacheNameNotLike(cacheName_notLike);
        }
        if (cacheName_in != null) {
            c.andCacheNameIn(cacheName_in);
        }
        if (cacheName_notIn != null) {
            c.andCacheNameNotIn(cacheName_notIn);
        }
        if (cacheName_between1 != null) {
            c.andCacheNameBetween(cacheName_between1, cacheName_between2);
        }
        if (cacheName_notBetween1 != null) {
            c.andCacheNameNotBetween(cacheName_notBetween1, cacheName_notBetween2);
        }
        String cacheKeyField_null = TypeCast.getString(workItemSubMap.get("cacheKeyField_null"));
        String cacheKeyField_notNull = TypeCast.getString(workItemSubMap.get("cacheKeyField_notNull"));
        String cacheKeyField = TypeCast.getString(workItemSubMap.get("cacheKeyField"));
        String cacheKeyField_not = TypeCast.getString(workItemSubMap.get("cacheKeyField_not"));
        String cacheKeyField_greater = TypeCast.getString(workItemSubMap.get("cacheKeyField_greater"));
        String cacheKeyField_greaterEqual = TypeCast.getString(workItemSubMap.get("cacheKeyField_greaterEqual"));
        String cacheKeyField_less = TypeCast.getString(workItemSubMap.get("cacheKeyField_less"));
        String cacheKeyField_lessEqual = TypeCast.getString(workItemSubMap.get("cacheKeyField_lessEqual"));
        String cacheKeyField_like = TypeCast.getString(workItemSubMap.get("cacheKeyField_like"));
        String cacheKeyField_notLike = TypeCast.getString(workItemSubMap.get("cacheKeyField_notLike"));
        List<String> cacheKeyField_in = TypeCast.getStringList(workItemSubMap.get("cacheKeyField_in"));
        List<String> cacheKeyField_notIn = TypeCast.getStringList(workItemSubMap.get("cacheKeyField_notIn"));
        String cacheKeyField_between1 = TypeCast.getString(workItemSubMap.get("cacheKeyField_between1"));
        String cacheKeyField_between2 = TypeCast.getString(workItemSubMap.get("cacheKeyField_between2"));
        String cacheKeyField_notBetween1 = TypeCast.getString(workItemSubMap.get("cacheKeyField_notBetween1"));
        String cacheKeyField_notBetween2 = TypeCast.getString(workItemSubMap.get("cacheKeyField_notBetween2"));

        if (cacheKeyField_null != null) {
            c.andCacheKeyFieldIsNull();
        }
        if (cacheKeyField_notNull != null) {
            c.andCacheKeyFieldIsNotNull();
        }
        if (cacheKeyField != null) {
            c.andCacheKeyFieldEqualTo(cacheKeyField);
        }
        if (cacheKeyField_not != null) {
            c.andCacheKeyFieldNotEqualTo(cacheKeyField_not);
        }
        if (cacheKeyField_greater != null) {
            c.andCacheKeyFieldGreaterThan(cacheKeyField_greater);
        }
        if (cacheKeyField_greaterEqual != null) {
            c.andCacheKeyFieldGreaterThanOrEqualTo(cacheKeyField_greaterEqual);
        }
        if (cacheKeyField_less != null) {
            c.andCacheKeyFieldLessThan(cacheKeyField_less);
        }
        if (cacheKeyField_lessEqual != null) {
            c.andCacheKeyFieldLessThanOrEqualTo(cacheKeyField_lessEqual);
        }
        if (cacheKeyField_like != null) {
            c.andCacheKeyFieldLike(cacheKeyField_like);
        }
        if (cacheKeyField_notLike != null) {
            c.andCacheKeyFieldNotLike(cacheKeyField_notLike);
        }
        if (cacheKeyField_in != null) {
            c.andCacheKeyFieldIn(cacheKeyField_in);
        }
        if (cacheKeyField_notIn != null) {
            c.andCacheKeyFieldNotIn(cacheKeyField_notIn);
        }
        if (cacheKeyField_between1 != null) {
            c.andCacheKeyFieldBetween(cacheKeyField_between1, cacheKeyField_between2);
        }
        if (cacheKeyField_notBetween1 != null) {
            c.andCacheKeyFieldNotBetween(cacheKeyField_notBetween1, cacheKeyField_notBetween2);
        }
        String cacheGetFields_null = TypeCast.getString(workItemSubMap.get("cacheGetFields_null"));
        String cacheGetFields_notNull = TypeCast.getString(workItemSubMap.get("cacheGetFields_notNull"));
        String cacheGetFields = TypeCast.getString(workItemSubMap.get("cacheGetFields"));
        String cacheGetFields_not = TypeCast.getString(workItemSubMap.get("cacheGetFields_not"));
        String cacheGetFields_greater = TypeCast.getString(workItemSubMap.get("cacheGetFields_greater"));
        String cacheGetFields_greaterEqual = TypeCast.getString(workItemSubMap.get("cacheGetFields_greaterEqual"));
        String cacheGetFields_less = TypeCast.getString(workItemSubMap.get("cacheGetFields_less"));
        String cacheGetFields_lessEqual = TypeCast.getString(workItemSubMap.get("cacheGetFields_lessEqual"));
        String cacheGetFields_like = TypeCast.getString(workItemSubMap.get("cacheGetFields_like"));
        String cacheGetFields_notLike = TypeCast.getString(workItemSubMap.get("cacheGetFields_notLike"));
        List<String> cacheGetFields_in = TypeCast.getStringList(workItemSubMap.get("cacheGetFields_in"));
        List<String> cacheGetFields_notIn = TypeCast.getStringList(workItemSubMap.get("cacheGetFields_notIn"));
        String cacheGetFields_between1 = TypeCast.getString(workItemSubMap.get("cacheGetFields_between1"));
        String cacheGetFields_between2 = TypeCast.getString(workItemSubMap.get("cacheGetFields_between2"));
        String cacheGetFields_notBetween1 = TypeCast.getString(workItemSubMap.get("cacheGetFields_notBetween1"));
        String cacheGetFields_notBetween2 = TypeCast.getString(workItemSubMap.get("cacheGetFields_notBetween2"));

        if (cacheGetFields_null != null) {
            c.andCacheGetFieldsIsNull();
        }
        if (cacheGetFields_notNull != null) {
            c.andCacheGetFieldsIsNotNull();
        }
        if (cacheGetFields != null) {
            c.andCacheGetFieldsEqualTo(cacheGetFields);
        }
        if (cacheGetFields_not != null) {
            c.andCacheGetFieldsNotEqualTo(cacheGetFields_not);
        }
        if (cacheGetFields_greater != null) {
            c.andCacheGetFieldsGreaterThan(cacheGetFields_greater);
        }
        if (cacheGetFields_greaterEqual != null) {
            c.andCacheGetFieldsGreaterThanOrEqualTo(cacheGetFields_greaterEqual);
        }
        if (cacheGetFields_less != null) {
            c.andCacheGetFieldsLessThan(cacheGetFields_less);
        }
        if (cacheGetFields_lessEqual != null) {
            c.andCacheGetFieldsLessThanOrEqualTo(cacheGetFields_lessEqual);
        }
        if (cacheGetFields_like != null) {
            c.andCacheGetFieldsLike(cacheGetFields_like);
        }
        if (cacheGetFields_notLike != null) {
            c.andCacheGetFieldsNotLike(cacheGetFields_notLike);
        }
        if (cacheGetFields_in != null) {
            c.andCacheGetFieldsIn(cacheGetFields_in);
        }
        if (cacheGetFields_notIn != null) {
            c.andCacheGetFieldsNotIn(cacheGetFields_notIn);
        }
        if (cacheGetFields_between1 != null) {
            c.andCacheGetFieldsBetween(cacheGetFields_between1, cacheGetFields_between2);
        }
        if (cacheGetFields_notBetween1 != null) {
            c.andCacheGetFieldsNotBetween(cacheGetFields_notBetween1, cacheGetFields_notBetween2);
        }
        if (workItemSubMap.get("orderBy") != null) {
            workItemSubEx.setOrderByClause((String) workItemSubMap.get("orderBy"));
        }
        if (limitStart != null && limitOffset != null) {
            workItemSubEx.setLimitStart(limitStart);
            workItemSubEx.setLimitOffset(limitOffset);
        }

        return workItemSubEx;
    }
}
